$(document).ready(function(){
    //个人消息
    if(myinfo['userid'] && myinfo['random']){
        $('.userinfo .user_money').html('账户余额：￥'+myinfo['money']);
        $('.userinfo .user_jifen').html('我的积分：'+myinfo['point']);
        $('.userinfo p').html(myinfo['nickname2']);
        $('.userinfo p').html(myinfo['nickname2']);
        $(".userinfo img").attr('src',myconfig['url']+myinfo['avatar']);
        $('.userinfo').show();
        $('.user').hide();
    }else {
        $('.userinfo').hide();
        $('.user').show();
    }
    //我的试用
    $("#mysy").click(function(){
        if(myinfo['userid'] && myinfo['random']){
            var mysy_list=myconfig['api']+'getorderlists';
            var userid=myinfo['userid'];
            var random=myinfo['random'];
            var mod='trial';
            var status='1';
            $.post(mysy_list, {userid:userid,random:random,mod:mod,status:status},function(data,status){

                window.location.href='./user/trial_order.html';
                //$.each(data.lists,function(key,item){
                //    htms='<li>';
                //    htms+='<div class="new_list_img"><img src="'+myconfig['url']+item.thumb+'"></div>';
                //    htms+='<div class="new_list_title">'+item.title+'</div>';
                //    htms+='<div class="new_list_price"><span>￥'+item.goods_price+'</span><b>'+item.number+'份</b></div>';
                //    htms+='</li>';
                //    $('#lun_list').append(htms);
                //});
            },'json');
        }else{
            window.location.href='./user/login.html';
        }
    })
    //提现
	$("#deposite").click(function(){
        if(myinfo['userid'] && myinfo['random']){
            var mysy_list=myconfig['api']+'getorderlists';
            var userid=myinfo['userid'];
            var random=myinfo['random'];
            var mod='trial';
            var status='1';
            $.post(mysy_list, {userid:userid,random:random,mod:mod,status:status},function(data,status){

                window.location.href='./user/deposite.html';
              
            },'json');
        }else{
            window.location.href='./user/login.html';
        }
    })
    //账户明细
    $("#user_log").click(function(){
        if(myinfo['userid'] && myinfo['random']){
                window.location.href='./user/user_log.html';
        }else{
            window.location.href='./user/login.html';
        }
    })
      //签到
    $("#qiandao").click(function () {
        if(myinfo['userid'] && myinfo['random']){
            var my_qiandao=myconfig['api']+'sign';
            var userid=myinfo['userid'];
            var random=myinfo['random'];
            $.post(my_qiandao, {userid:userid,random:random},function(data,status){
                if(data.status == 0){
                    art.dialog({
                        lock: true,
                        fixed: true,
                        icon: 'face-sad',
                        title: '错误提示',
                        content: data.msg,
                        ok: true
                    });
                }else if(data.status == 1){
                    art.dialog({
                        lock: true,
                        fixed: true,
                        icon: 'face-smile',
                        title: '签到成功',
                        content: data.msg,
                        ok: true
                    });
                }
            },'json');
        }else{
            window.location.href='./user/login.html';
        }
    })
});
